import axios from "axios"

const service = axios.create({
  baseURL: process.env.BASE_API,
  timeout: 60 * 1000
})

/** 请求拦截器 */
service.interceptors.request.use(
  config => {
    return config
  },
  error => {
    console.log('request error -> ', error)
    return Promise.reject(error)
  }
)

/** 响应拦截器 */
service.interceptors.response.use(
  response => {
    return response
  },
  error => {
    console.log('response error -> ', error)
    return Promise.reject(error)
  }
)

export default service